package com.zyy.dao;

import com.zyy.pojo.Department;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 部门dao
 * @Author: zyy
 * @Date: 2022/07/31 15:41
 */
@Repository
public class DepartmentDao {

    private static Map<Integer, Department> departmentMap = null;

    static {
        departmentMap = new HashMap<>();

        departmentMap.put(101, new Department(101, "教学部"));
        departmentMap.put(102, new Department(102, "市场部"));
        departmentMap.put(103, new Department(103, "教研部"));
        departmentMap.put(104, new Department(104, "运营部"));
        departmentMap.put(105, new Department(105, "后勤部"));
    }

    /**
     * 获取所有部门信息
     */
    public Collection<Department> getDepartments() {
        return departmentMap.values();
    }


    /**
     * 根据id获取部门信息
     */
    public Department getDepartmentById(Integer id) {
        return departmentMap.get(id);
    }
}
